Microsoft Learning Components
LearningDataModel

When a package is executed (i.e. learner attempts it), each activity (page) of the package has a data model as defined by SCORM 2004 and 1.2.

Microsoft Learning Components implements the data model in two ways. The two examples below perform the same action—the first using client code executing in a browser, the second using server code.

  1. MLC implements the SCORM RTE (JavaScript-based run-time environment) in the Session Frameset. SCORM content can access the RTE using JavaScript such as the following:
    JavaScript
    rteapi.SetValue("cmi.completion_status", "completed");
  2. Applications written in CLR-compatible languages such as C# and Visual Basic can access the data model of an activity as follows:
    C#
    learningSession.DataModel.CompletionStatus = CompletionStatus.Completed;

The first approach is documented in the SCORM Run-Time Environment documentation.

For the second approach, these are typical steps for accessing the data model of the current activity of an attempt.

  1. Acquire an instance of StoredLearningSession. For example, call the StoredLearningSession constructor or StoredLearningSession.CreateAttempt. Note that the following steps assume that the learning session has a current activity.
  2. Retrieve the MLC object model corresponding to the current activity's SCORM data model by reading the value of the StoredLearningSession.CurrentActivityDataModel property.
  3. Use methods and properties of the returned LearningDataModel object to read and/or write the data model for the current activity.
  4. If you wrote to the data model, call StoredLearningSession.CommitChanges to write the changes back to the database.
For More Information
Microsoft.LearningComponents.DataModel Namespace (API Reference)
LearningDataModel Class (API Reference)
StoredLearningSession.CurrentActivityDataModel (API Reference)
Next Topic: LearningStore